
@extends('layouts.admin')
      @section('xgshopym')
      <li><a href="{{URL('admin/shopym')}}"> 编辑商品</a></li>
      <li><a href="{{URL('admin/shopym/add')}}"> 增加商品</a></li>
      @endsection
      @section('xgleibie')
      <li><a href="{{url('admin/leibie')}}">编辑类别</a></li>
      <li><a href="{{url('admin/leibie/add')}}" > 增加类别</a></li>
      @endsection
      @section('bjvip')
      <li class="active"><a href="{{url('admin/user')}}"><i class="fa fa-user"></i><span>会员管理</span></a></li>
      @endsection
      @section('xgdingdan')
      <li><a href="{{url('admin/dingdan')}}"><i class="fa fa-cube"></i><span>编辑订单</span></a></li>
      @endsection
      @section('xggonggao')
      <li><a href="{{URL('admin/gonggao')}}"> 编辑公告</a></li>
      <li><a href="{{URL('admin/gonggao/add')}}"> 增加公告</a></li>
      @endsection
      @section('page-wrapper')
        <div class="content">
            <div class="row">
                <div class="col-sm-4 col-3">
                    <h4 class="page-title">会员管理</h4>
                </div>
                <!-- <div class="col-sm-8 col-9 text-right m-b-20">
                    <a href="{{url('admin/shopym/add')}}" class="btn btn btn-primary btn-rounded float-right"><i class="fa fa-plus"></i> 添加商品</a>
                </div> -->
            </div>

           
            <div class="row">
              <div class="col-md-12">
                <div class="table-responsive">
                  <table class="table table-border table-striped custom-table mb-0">
                     <form action="{{url('admin/user/delall')}}" method="post" >
                    <thead>
                      <tr>
                        <th  class="text-center">复选</th>
                        <th  class="text-center"  style="margin-left: -50px;">用户姓名</th>
                        <th  class="text-center">用户密码</th>
                        <th  class="text-center">用户电话</th>
                        <th  class="text-center">用户地址</th>
                        <th  class="text-center">用户邮箱</th>
                        <th  class="text-center">注册时间</th>
                        <th class="text-center">操作</th>
                      </tr>
                    </thead>
                    <tbody>
                    @foreach($result as $value)
                      <tr>
                        <td  class="text-center"><input type="checkbox" name="checked[]" style="zoom:140%;" value="{{$value->userid}}"/></td>
                        <td  class="text-center" style="margin-left: -50px;">{{$value->username}}</td>
                        <td  class="text-center">{{$value->password}}</td>
                        <td  class="text-center">{{$value->tel}}</td>
                        <td  class="text-center">{{$value->adress}}</td>
                        <td  class="text-center">{{$value->email}}</td>
                        <td  class="text-center">{{$value->redtime}}</td>
                        <td class="text-center">
                            <!-- <a class="btn btn-primary" href="{{URL('admin/xgshopym',$value->userid)}}"> 修改</a> -->
    
                            <a class="btn btn-danger delbtn" href= "{{URL('admin/deluser',$value->userid)}}" style="color: #fff;background-color: #f62d51;"> 删除</a>
                        </td>		
                      </tr>
                    @endforeach	

                    {{csrf_field()}} 
                      <tr style="width: 100%;">                   
                        <td><input type="submit" value="删除选择项" class="btn btn-danger float-left" ></td>
                        <td style="display: inline-block; margin-right: -80px;margin-top: 15px;border-style: none ;">{{$result->links()}}</td> 
                      </tr>
                    </tbody>
                     </form> 
                  </table>
                </div>
              </div>
            </div>
          
        </div>

            <!-- <div class="notification-box">
                <div class="msg-sidebar notifications msg-noti">
                    <div class="topnav-dropdown-header">
                        <span>Messages</span>
                    </div>
                   
                    <div class="topnav-dropdown-footer">
                        <a href="chat.html">See all messages</a>
                    </div>
                </div>
            </div>
        </div> -->

        <!-- 删除模态框 -->
		<!-- <div id="delete_patient" class="modal fade delete-modal" role="dialog">
			<div class="modal-dialog modal-dialog-centered">
				<div class="modal-content">
					<div class="modal-body text-center">
						<h3>你确定要删除此类别嘛?</h3>
						<div class="m-t-20">
							<button type="submit" class="btn btn-danger">确定</button>
                             <a href="#" class="btn btn-white" data-dismiss="modal">关闭</a>
						</div>
					</div>
				</div>
			</div>
			
		</div> -->
  <!-- 引入 layui.css -->
  <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css">
  <script src="{{URL::asset('root\js/jquery-3.2.1.min.js')}}"></script>
  <!-- 引入 layui.js -->
  <script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>

  <script>
    // 生成一个token crsf
    
    const _token = "{{csrf_token()}}";
    // 给删除按钮绑定事件
    $('.delbtn').click(function(evt){
        // 得到请求的URL地址
        let url = $(this).attr('href');
        // 发起一个delete请求
        $.ajax({
            url,
            data:{_token},
            type:'DELETE',
            dataType:'json'
        }).then(({status,msg})=>{
            if(status == 0){
                // 提示插件
                layer.msg(msg, {time: 2000,icon: 1},()=>{
                    $(this).parents('tr').remove();
                });
            }
        });

        // jQuery取消默认事件
        return false;
        
    });
  </script>
 @endsection
